<?php

/**
 * O2O团购PC版本
 * ============================================================================
 * * 版权所有 2009-2016 郑州司科计算机科技有限公司，并保留所有权利。
 * 购买网址: http://www.jzphp.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
  * 咨询电话：400-823-0371 QQ：313999875
 * ============================================================================
 * $Author: zzsike $
 * $Time 2016-02-03 sammy $
*/


require_once(dirname(dirname(dirname(__FILE__))) . '/app.php');
need_manager();
need_auth('order');

$pc = array('flage_id' => '0',);
$packages = DB::LimitQuery('package', array(
	    'condition'=>$pc,
		'order' => 'ORDER BY id  DESC ',
            ));	
$kn = array(
		'id' => '包裹id',
		'pakagestate' => '发货状态',
        'username' => '用户名',
		'usermail' => '用户邮箱',
		'title' => '内件品名及数量',
		'express_xx' => '要求快递',
		'pakageinf' => '发货信息',
		'address' => '送货地址',
		'realname' => '收件人姓名',
		'zipcode' => '邮编',
		'mobile' => '手机号码',
		'phone' => '电话',
		'remark' => '留言备注',
		'idshow' => '包含订单',
	);
$name = 'package_A_'.date('Ymd');
    $ids=array();
	foreach($packages AS $one ) {
		$ids= Utility::ExtraDecode($one['team_id']);
		foreach($ids AS $key=>$value)
		$one['idshow']=$one['idshow'].'['.$value.']';
		$one['express_xx']=$one['express_xx'];
		$one['pakagestate']=$one['express_id']==0?'未发货':'已发货';
		if($one['express_id'])$one['pakageinf']=$option_express[$one['express_id']].'：'.$one['express_no'];
		$user = Table::Fetch('user', $one['user_id']);
		$one['usermail'] = $user['email'];
		$one['id'] = "#{$one['id']}";
		$one['username'] = $user['username'];
		$one['phone'] = $user['mobile'];
		$eorders[] = $one;
	}


down_xls($eorders, $kn, $name);